#---------------------------------------------------------
# VisualK-OS                                              
#    Module: Slave/Device Client Scan Screen class [v1.0] 
#    Author: Kevin Slaughter                              
#---------------------------------------------------------

"""
[Revision History]
    v1.0: Initial implementation... Having the screens encapsulated by
            the ScreenManager class with if-then-else blocks worked at
            first, when not much as required of the program, but more
            complex classes arose out of necessity to shrink/simplify
            the growing source code.
"""

import globals
from VKCC_Constants import *


class cScreenClientScan(object):
    ### General properties
    color = 2                            # Color theme used within this screen
    title = "Slave/Device Client Scan"   # Title to be displayed
    hasExit = True                       # Flag: Display exit option
    
    
    ### handleKey(): Handle any passed keyboard input independent of GP usage.
    def handleKey(self, c, scr):
        if (c == KEY_0): scr.changeScreen(SCREEN_MAIN)	# 0 = Back to main menu
        return
    
    
    ### paint(): Draw any elements used on this screen.
    def paint(self, scr):
        scr.menuPrep(self)
        
        # Check for Thor
        # TODO: Assert Thor
        scr.printText(2,4, "[*] Thor:")
        if (globals.Thor.isAvailable==False):
            scr.printText(25,4, "<Not Connected>", T_ERROR,"u")
        else:
            if (globals.emulateSlaves): scr.printText(25,4, "<Emulated>", T_ERROR,"u")
            else:   scr.printText(25,4, "<Connected>", T_NORMAL,"u")

        # Check for SynthStation
        # TODO: Assert SS
        scr.printText(2,5, "[*] Synth-Station:")
        if (globals.SynthStation.isAvailable==False):
            scr.printText(25,5, "<Not Connected>", T_ERROR,"u")
        else:
            if (globals.emulateSlaves): scr.printText(25,5, "<Emulated>", T_ERROR,"u")
            else: scr.printText(25,5, "<Connected>", T_NORMAL,"u")
            
        # Disable re-scan option if we're emulating
        if not globals.emulateSlaves: scr.printText(2,7, "9.) Re-Scan", T_HIGHLIGHT)
        return
    